import { SelectControlSchema } from 'amis/lib/renderers/Form/Select'
import serverSelectUtils, { ServerSelectUtilsProps } from '@/components/amis/ServerSelectUtils/serverSelectUtils'
import captchaSmsAdminApiConfig from '@/core/captchaSms/generated/apiconfig/captchaSmsAdminApiConfig'

class CaptchaSmsItemConfigIdSelectUtils {
	getSchema = (parmas?: Partial<ServerSelectUtilsProps>): SelectControlSchema => {
		const mergeProps = Object.assign(
			{
				name: 'captchaSmsItemConfigId',
				label: '短信验证码配置',
				labelField: 'title',
				searchField: 'title',
				valueField: 'id',
				detailApiConfig: captchaSmsAdminApiConfig.captchaSmsItemConfig.get,
				searchApiConfig: captchaSmsAdminApiConfig.captchaSmsItemConfig.search,
			} as ServerSelectUtilsProps,
			parmas,
		)
		return serverSelectUtils.getSchema(mergeProps)
	}
}

export default new CaptchaSmsItemConfigIdSelectUtils()
